package com.adxon.data2;

import com.adxon.MsgException;

public class Data extends Base{
	protected long tc;		// create time
	protected long tm;		// modify time

	@Override
	public void commit()throws MsgException{
		if(tm==0)
			super.commit();
	}
	@Override
	protected void commitExt()throws MsgException{
		super.commitExt();
		tm=System.currentTimeMillis();
		if(tc==0)
			tc=tm;
		commit("tc",tc);
		commit("tm",tm);
	}
	public long getCreateTime(){
		return tc;
	}
	public long getTime(){
		return tm;
	}
	@Override
	public void reset(){
		super.reset();
		tc=tm=0;
	}
	public void setAll(Data src){
		super.setAll(src);
		tc=src.tc;
		tm=src.tm;
	}
	public void setTime(long time){
		tm=time;
	}
	@Override
	public void updateExt()throws MsgException{
		super.updateExt();
		tc=updateLong("tc");
		tm=updateLong("tm");
	}
}